/*
* Author: Sowmya Kameswaran
*/
package com.foo.SpatialData;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;



public class SpatialDataClient 
{
	SpatialDataProviderRemote dataprovider = null;
	public SpatialDataClient()
	{
		try
		{
			Properties properties = new Properties();
			properties.put(Context.PROVIDER_URL, "jnp://localhost:1099");
			properties.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
			properties.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
			Context ctx = new InitialContext(properties);
			Object ref = ctx.lookup("SpatialDataProvider/remote");
			//DataProviderRemote 
			dataprovider = (SpatialDataProviderRemote) PortableRemoteObject.narrow(ref, SpatialDataProviderRemote.class);

		}
		catch(Exception e)
		{
			e.printStackTrace();
		}	
	}
	public void sendspatialinfo(String sorttype,String info)
	{
		dataprovider.SpacialData(sorttype, info);
		System.out.println("Sending data to server");
	}
}
